﻿using System;
using System.Data;
using System.Collections.Generic;
using IDAL;
using Model;

namespace BLL
{
    public class Repair
    {
        private static readonly IRepair dal = DALFactory.DataAccess.CreateRepair();

        public bool RepairItem_Insert(DateTime recordTime, string userID, string remark, DataTable sNdt, DataTable stepdt)
        {
            return dal.RepairItem_Insert(recordTime, userID, remark, sNdt, stepdt);
        }

        public bool Repair_AutoBuild(string productSN, string repairPath, string userID)
        {
            try
            {
                dal.Repair_AutoBuild(productSN, repairPath, userID);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public RepairInfo GetRepairbyLast(string productSN)
        {
            return dal.GetRepairbyLast(productSN);
        }

        public RepairInfo GetRepairbySNDT(string productSN, DateTime recordTime)
        {
            return dal.GetRepairbySNDT(productSN, recordTime);
        }

        public IList<RepairInfo> GetRepairbySN(string productSN)
        {
            return dal.GetRepairbySN(productSN);
        }

        public IList<RepairInfo> GetRepairbyPackageSN(string packageSN)
        {
            return dal.GetRepairbyPackageSN(packageSN);
        }

        public IList<RepairInfo> GetRepairbyDT(DateTime dt1, DateTime dt2)
        {
            return dal.GetRepairbyDT(dt1, dt2);
        }
    }
}
